package com.baihejia.common.dubbo.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Page<T> implements Serializable {

    public List<T> items = new ArrayList<>();

    public long count;

    public long showCount;

    public List<T> extraItems = new ArrayList<>();

    public Page() {
    }

    public Page(List<T> items, long count, long showCount) {
        this.items = items;
        this.count = count;
        this.showCount = showCount;
    }

    public Page<T> add(T item) {
        this.extraItems.add(item);
        return this;
    }

    public int size() {
        return this.items.size() + this.extraItems.size();
    }

    public boolean contains(T item) {
        return this.items.contains(item) || this.extraItems.contains(item);
    }
}
